#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::WidgetClass())
{
    ui->setupUi(this);

    connect(ui->horizontalSlider, &QSlider::valueChanged, this, &Widget::do_valueChanged);
    connect(ui->dial, &QDial::valueChanged, this, &Widget::do_valueChanged);
    connect(ui->horizontalScrollBar, &QScrollBar::valueChanged, this, &Widget::do_valueChanged);


}

Widget::~Widget()
{
    delete ui;
}

void Widget::do_valueChanged(int value)
{
    //进度条
    ui->progressBar->setValue(value);
}

void Widget::on_checkBox_Visible_clicked(bool checked)
{
    //显示进度条文本
    ui->progressBar->setTextVisible(checked);
}

void Widget::on_checkBox_Inverted_clicked(bool checked)
{
    //进度条反向显示
    ui->progressBar->setInvertedAppearance(checked);

}

void Widget::on_radioButton_Percent_clicked()
{
    ui->progressBar->setFormat("%p%");
}

void Widget::on_radioButton_Value_clicked()
{
    ui->progressBar->setFormat("%v");
}
